<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <th:block th:include="MainInterface/include :: common-css" />

</head>
<body class="fixed-left">
<div id="wrapper">

    <th:block th:include="MainInterface/include :: header-menu(3)" />

    <div class="content-page">
        <div class="content">
            <div class="container">
                <div class="row" id="all">
                    <div class="col-sm-12">
                        <h1 class="page-title">状态管理</h1>
                    </div>
                    <div class="col-md-12">
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>类别名字</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="statusList:${statusList}">
                                <td th:text="${statusList.id}"></td>
                                <td th:text="${statusList.statusName}"></td>
                                <td>
                                    <a th:href="${'/bookStatus/edit'+statusList.id}"
                                       class="btn btn-primary btn-sm waves-effect waves-light m-b-5">
                                        <i class="fa fa-edit"></i> <span>编辑</span></a>
                                    <a href="javascript:void(0)" th:onclick="'delArticle('+${statusList.id}+')'"
                                       class="btn btn-danger btn-sm waves-effect waves-light m-b-5">
                                        <i class="fa fa-trash-o"></i> <span>删除</span></a>
                                </td>
                            </tr>
                            </tbody>
                        </table>


                    </div>
                </div>


            </div>
            </div>
        </div>
    </div>
</div>

<th:block th:include="MainInterface/include :: foter" />
<th:block th:include="MainInterface/include :: common-js" />
<script>
    function delCategroy(id){
        if(confirm('确定删除该数据吗?')){
            $.ajax({
                type:"post",
                url:"/bookCategroy/delete",
                data:{id:id},
                dataType: 'json',
                success:function (result) {
                    if(result.code==0){
                        window.alert("删除成功");
                        window.location.reload();
                    } else {
                        window.alert(result.msg || "删除失败");
                    }

                }
            });
        }

    }

    function categroyAdd(){
        // $("#add").show();
        $.ajax({
            type:"post",
            url:"/bookStatus/saveOrUpdata",
            data:$("#bookList").serialize(),
            async:false,
            dataType: 'json',
            success:function (result) {
                console.log($("#bookList").serialize(),)
                if(result.code==0){
                    window.alert("添加成功");
                    window.location.href="/bookStatus"
                } else {
                    window.alert(result.msg || "添加失败");
                }

            }
        });
    }
    function add(){
        $("#add").show();
        $("#all").hide();
    }
</script>
</body>
<style>
    .id{
        position: relative;
        cursor: pointer;
        display: inline-block;
        overflow: hidden;
    }
    table td {
        font-size: 12px;
        padding: 10px 30px;

        border-bottom: 1px solid #999;

        border-right: 1px solid #999;
    }
    table {
        border-top: 1px solid #999;

        border-left: 1px solid #999;

        border-spacing: 0;/*去掉单元格间隙*/

    }

</style>

</html>
